package com.ndp.fb.enums.targetingspec;

import lombok.Getter;

/**
 * Created by sisi.chen on 15-4-8.
 */
@Getter
public enum LocationType {
    /**
     * 1  这个地区的所有人
     */
    All(1, "all"),

    /**
     * 2  在这里居住的用户
     */
    Home(2, "home"),

    /**
     * 3  最近到过这里的用户
     */
    Recent(3, "recent"),

    /**
     * 4  在这里旅游的人
     */
    Travel_in(4, "travel_in");

    private int code;

    private String locationType;

    private LocationType(int code, String locationType) {
        this.code = code;
        this.locationType = locationType;
    }

    /**
     * 根据code获取locationType
     *
     * @param code code
     * @return locationType
     */
    public static LocationType getLocationType(int code) {
        for (LocationType c : LocationType.values()) {
            if (c.code == code) {
                return c;
            }
        }
        return null;
    }
}
